package com.kaifamiao.month04.day22;

import java.util.HashMap;
import java.util.Iterator;
//import java.util.Map;

public class Test02 {

//    int a = 0;


    // 快排
    public static void quickSort(int[] arr, int left, int right) {
        if (left >= right) {
            return;
        }
        int temp = arr[left];
        int l = left, r = right;
        while (l < r) {
            while (arr[r] >= temp && l < r) {
                r--;
            }
            while (arr[l] <= temp && l < r) {
                l++;
            }
            int t = arr[r];
            arr[r] = arr[l];
            arr[l] = t;
        }
        arr[left] = arr[r];
        arr[r] = temp;
        quickSort(arr, left, r - 1);
        quickSort(arr, r + 1, right);
    }

    // 迭代器
    public static void iter(HashMap<Integer, String> map) {
        Iterator<Integer> it = map.keySet().iterator();
        while (it.hasNext()) {
            int i = it.next(); // 如果不存起来的话  使用it.next() 拿到的就是下一个元素
            System.out.println( i + map.get(i));
        }
    }

    public void test01() {
//        int a;
//        a ++;  // a 没有被初始化
    }

    public static void main(String[] args) {

//        int[] arr = {2, 0, -1, 3, 5, 6};
//        quickSort(arr, 0, arr.length - 1);
//        System.out.println(Arrays.toString(arr));

//        Map<Integer, String> map = Map.of(1, "a", 2, "b", 3, "c");
//        HashMap<Integer, String> hashMap = new HashMap<>(map);
//        hashMap.put(null,null);
//        hashMap.put(null,"1");
//        hashMap.put(null,"2");
////        iter(hashMap);
//        System.out.println(hashMap);

        System.out.println(12 >> 1);

    }
}
